@{ Layout = "../Shared/_Layout.cshtml"; } @section Navs{
<li class="nav-item">
  <a class="nav-link" href="pageUser.aspx">用户管理</a>
</li>
<li class="nav-item">
  <a class="nav-link" href="userGroup.cshtml">用户组管理</a>
</li>
<li class="nav-item">
  <a class="nav-link" href="userStyle.cshtml">用户字段</a>
</li>
<li class="nav-item">
  <a class="nav-link active" href="userConfig.cshtml">用户设置</a>
</li>
<li class="nav-item">
  <a class="nav-link" href="userHome.cshtml">用户中心设置</a>
</li>
<li class="nav-item">
  <a class="nav-link" href="userMenu.cshtml">用户中心菜单</a>
</li>
}

<template v-if="pageType === 'list'">
  <p class="text-muted font-14">
    请点击链接更改用户设置
  </p>

  <table class="table table-bordered table-striped">
    <tbody>
      <tr>
        <td width="35%">允许新用户注册</td>
        <td width="65%">
          <a href="javascript:;" v-on:click="pageType = 'isUserRegistrationAllowed'" class="editable">
            <span v-show="config.isUserRegistrationAllowed">允许</span>
            <span v-show="!config.isUserRegistrationAllowed">禁止</span>
          </a>
        </td>
      </tr>
      <tr>
        <td width="35%">新注册用户需要管理员审核</td>
        <td width="65%">
          <a href="javascript:;" v-on:click="pageType = 'isUserRegistrationChecked'" class="editable">
            <span v-show="config.isUserRegistrationChecked">不需要审核</span>
            <span v-show="!config.isUserRegistrationChecked">需要管理员审核</span>
          </a>
        </td>
      </tr>
      <tr>
        <td width="35%">允许用户销注</td>
        <td width="65%">
          <a href="javascript:;" v-on:click="pageType = 'isUserUnRegistrationAllowed'" class="editable">
            <span v-show="config.isUserUnRegistrationAllowed">允许</span>
            <span v-show="!config.isUserUnRegistrationAllowed">禁止</span>
          </a>
        </td>
      </tr>
      <tr>
        <td>密码最小长度</td>
        <td>
          <a href="javascript:;" v-on:click="pageType = 'userPasswordMinLength'" class="editable">
            <span v-show="config.userPasswordMinLength === 0">不限制密码长度</span>
            <span v-show="config.userPasswordMinLength > 0">{{ config.userPasswordMinLength }}</span>
          </a>
        </td>
      </tr>
      <tr>
        <td>密码规则限制</td>
        <td>
          <a href="javascript:;" v-on:click="pageType = 'userPasswordRestriction'" class="editable">
            {{ getPasswordRestrictionText(config.userPasswordRestriction) }}
          </a>
        </td>
      </tr>
      <tr>
        <td>同一IP注册间隔限制</td>
        <td>
          <a href="javascript:;" v-on:click="pageType = 'userRegistrationMinMinutes'" class="editable">
            <span v-show="config.userRegistrationMinMinutes === 0">不限制</span>
            <span v-show="config.userRegistrationMinMinutes > 0">{{ config.userRegistrationMinMinutes }} 分钟</span>
          </a>
        </td>
      </tr>
      <tr>
        <td>登录失败锁定</td>
        <td>
          <a href="javascript:;" v-on:click="pageType = 'isUserLockLogin'" class="editable">
            {{ (config.isUserLockLogin ? '开启登录失败锁定' : '不锁定') }}
          </a>
        </td>
      </tr>

    </tbody>
  </table>
</template>
<template v-else>

  <template v-if="pageType === 'isUserRegistrationAllowed'">

    <div class="form-group">
      <label>允许新用户注册</label>
      <select v-model="isUserRegistrationAllowed" class="form-control">
        <option v-bind:value="true">允许</option>
        <option v-bind:value="false">禁止</option>
      </select>
      <small class="form-text text-muted">选择否将禁止新用户注册, 但不影响过去已注册的会员的使用</small>
    </div>

  </template>
  <template v-else-if="pageType === 'isUserUnRegistrationAllowed'">

    <div class="form-group">
      <label>允许用户销注</label>
      <select v-model="isUserUnRegistrationAllowed" class="form-control">
        <option v-bind:value="true">允许</option>
        <option v-bind:value="false">禁止</option>
      </select>
      <small class="form-text text-muted">用户销注将永久删除此用户账户以及帐户中的所有数据</small>
    </div>

  </template>
  <template v-else-if="pageType === 'isUserRegistrationChecked'">

    <div class="form-group">
      <label>新注册用户需要管理员审核</label>
      <select v-model="isUserRegistrationChecked" class="form-control">
        <option v-bind:value="true">不需要审核</option>
        <option v-bind:value="false">需要管理员审核</option>
      </select>
    </div>

  </template>
  <template v-else-if="pageType === 'userPasswordMinLength'">

    <div class="form-group">
      <label>
        密码最小长度
        <small v-show="errors.has('userPasswordMinLength')" class="text-danger">{{
          errors.first('userPasswordMinLength') }}</small>
      </label>
      <input v-model="userPasswordMinLength" name="userPasswordMinLength" data-vv-as="密码最小长度" v-validate="'required|numeric'"
        :class="{'is-invalid': errors.has('userPasswordMinLength') }" type="text" class="form-control" />
      <small class="form-text text-muted">0代表不限制密码长度</small>
    </div>

  </template>
  <template v-else-if="pageType === 'userPasswordRestriction'">

    <div class="form-group">
      <label>密码规则限制</label>
      <select v-model="userPasswordRestriction" class="form-control">
        <option value="LetterAndDigit">{{ getPasswordRestrictionText('LetterAndDigit') }}</option>
        <option value="LetterAndDigitAndSymbol">{{ getPasswordRestrictionText('LetterAndDigitAndSymbol') }}</option>
        <option value="None">{{ getPasswordRestrictionText('None') }}</option>
      </select>
    </div>

  </template>
  <template v-else-if="pageType === 'userRegistrationMinMinutes'">

    <div class="form-group">
      <label>
        同一IP注册间隔限制（单位：分钟）
        <small v-show="errors.has('userRegistrationMinMinutes')" class="text-danger">{{
          errors.first('userRegistrationMinMinutes') }}</small>
      </label>
      <input v-model="userRegistrationMinMinutes" name="userRegistrationMinMinutes" data-vv-as="同一IP注册间隔限制" v-validate="'required|numeric'"
        :class="{'is-invalid': errors.has('userRegistrationMinMinutes') }" type="text" class="form-control" />
      <small class="form-text text-muted">同一IP在本时间间隔内将只能注册一个帐号，0 为不限制</small>
    </div>

  </template>
  <template v-else-if="pageType === 'isUserLockLogin'">

    <div class="form-group">
      <label>登录失败锁定</label>
      <div class="m-2">
        <div class="radio radio-primary form-check-inline">
          <input type="radio" id="radio1" v-model="isUserLockLogin" value="true">
          <label for="radio1">开启登录失败锁定</label>
        </div>
        <div class="radio radio-primary form-check-inline">
          <input type="radio" id="radio2" v-model="isUserLockLogin" value="false">
          <label for="radio2">不锁定</label>
        </div>
      </div>
    </div>
    <div v-show="isUserLockLogin" class="form-group">
      <label>
        登录失败次数锁定（次）
        <small v-show="errors.has('userLockLoginCount')" class="text-danger">{{
          errors.first('userLockLoginCount') }}</small>
      </label>
      <input v-model="userLockLoginCount" name="userLockLoginCount" data-vv-as="登录失败次数锁定" v-validate="'required|numeric'"
        :class="{'is-invalid': errors.has('userLockLoginCount') }" type="text" class="form-control">
      <small class="form-text text-muted">一旦登录失败达到指定次数之后用户就会被锁定</small>
    </div>
    <div v-show="isUserLockLogin" class="form-group">
      <label>用户登录锁定类型</label>
      <select v-model="userLockLoginType" class="form-control">
        <option value="Hours">按小时锁定</option>
        <option value="Forever">永久锁定</option>
      </select>
    </div>
    <div v-show="isUserLockLogin && userLockLoginType === 'Hours'" class="form-group">
      <label>
        登录锁定时间（小时）
        <small v-show="errors.has('userLockLoginHours')" class="text-danger">{{
          errors.first('userLockLoginHours') }}</small>
      </label>
      <input v-model="userLockLoginHours" name="userLockLoginHours" data-vv-as="登录锁定时间" v-validate="'required|numeric'"
        :class="{'is-invalid': errors.has('userLockLoginHours') }" type="text" class="form-control">
    </div>

  </template>



  <hr />

  <div class="text-center">
    <button class="btn btn-primary m-r-5" v-on:click="btnSubmitClick">保 存</button>
    <button class="btn m-r-5" v-on:click="pageType = 'list'">返 回</button>
  </div>

</template>

@section Scripts{
<script src="userConfig.js" type="text/javascript"></script> }